Important: A pointer is nothing more than an address
A variable that stores the address of some value
A pointer typically takes up 8 bytes of memory in C
0x) addresses, which is approximately 4 GB of RAM.Disk drives are just storage space, manipulation and use of data can only take place in RAM.
Memory is basically a huge array of 8-bit wide bytes.
Different data types take up different amounts of bytes of RAM.
int is 4 bytes, char is 1 byte, float is 4 bytes, double is 8 bytes, et cetera.& is the address-of/address-extraction operator<type>* <variable_name> = &<expression>* lets us dereference pointers—it retrieves what’s stored at a pointer*<pointer>)#include <stdio.h>
int main(void)
{
int n = 50;
int *p = &n; // Get the address of n in memory
printf("%p\n", p);
printf("%i\n", *p); // Get what is stored at the address in p
}Pointer that points to nothing.
NULL (see: Garbage)if (<pointer> == NULL))If you try to dereference a NULL pointer (e.g., *<NULL pointer>), you’ll segfault, which is better than accidental dangerous manipulation of unknown pointers.